package cn.xyafu.service.impl;

import cn.xyafu.dao.NewsDao;
import cn.xyafu.po.News;
import cn.xyafu.po.User;
import cn.xyafu.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsDao newsDao;
    //发送消息
    @Override
    public int addNews(News news) {
        return this.newsDao.addNews(news);
    }
    //通过接收者id查询消息
    @Override
    public List<News> findNewsByUser(HashMap<String,Object> map) {
        return this.newsDao.findNewsByUser(map);
    }
    //User相关消息条数
    public Integer countNewsByUser(User user){
        return this.newsDao.countNewsByUser(user);
    }
    //删除消息（消息id）
    @Override
    public Integer deleteNewsByNews(News news) {
        return this.newsDao.deleteNewsByNews(news);
    }
}
